import { _decorator, Component, find, Label, Node, v2, v3 } from 'cc';
import { UIBase } from '../../FrameWork3.8.6/FrameWork/UIFramework/UIBase';
import { ModuleMgr } from '../../FrameWork3.8.6/FrameWork/Module/ModuleMgr';
import { PlayerLayer } from '../Game/ModuleLayer/PlayerLayer';
import { Emitter } from '../../FrameWork3.8.6/FrameWork/Common/Emitter';
import { FollowCamera } from '../Game/Object/FollowCamera';
import { GameManager } from '../Game/Manager/GameManager';
const { ccclass, property } = _decorator;

@ccclass('PausePanel')
export class PausePanel extends UIBase{
    onInit(...rest: any[]): void {
        this.getComp<Label>("_LevelNameLabel","Label").string=rest[0];
        this.addClickEventListener("_ReBackLevelBtn",()=>{
            //获取Camera脚本
            let camera=find("Canvas/FollowCamera").getComponent(FollowCamera);
            //这里通过发送消息给相机
            Emitter.instance.emit("RemoveCamera",camera);
            this.closeUI("MainUI",true);
            this.closeUI("GameUI",true);
            this.openUI("LevelPanel",true,true);
            this.openUI("Menu");

        
        })

        //继续游戏按钮的制作

        this.addClickEventListener("_ContinueBtn",()=>{
            GameManager.instance.timePause=false;
            this.closeSelf();
        })


    }
}


